import requestModule from './request.js'
const { api } = requestModule

/**
 * 获取openid
 * @returns
 * @param {string} code 微信code
 */
export const getOpenid = (data) => api.post('/get_openid.php', data)

/**
 * 获取手机号
 * @returns
 * @param {string} openid 用户openid
 * @param {string} code 微信code
 */
export const decodePhone = (data) => api.post('/decode_phone.php', data)

/**
 * 获取日期
 * @returns
 * @param {string} openid 用户openid
 */
export const getDateConfig = (data) => api.post('/get_day.php', data)

/**
 * 获取时间
 * @returns
 * @param {string} openid 用户openid
 * @param {string} day 日期
 */
export const getTimeConfig = (data) => api.post('/get_time.php', data)

/**
 * 获取工厂
 * @returns
 * @param {string} openid 用户openid
 */
export const getGround = (data) => api.post('/get_ground.php', data)

/**
 * 预约列表
 * @returns
 * @param {string} openid 用户openid
 */
export const reservationList = (data) => api.post('/reservation_list.php', data)

/**
 * 预约详情
 * @returns
 * @param {string} id 预约id
 */
export const reservationDetail = (data) =>
  api.post('/reservation_detail.php', data)

/**
 * 取消预约
 * @returns
 * @param {string} id 预约id
 */
export const reservationCancel = (data) =>
  api.post('/reservation_cancel.php', data)

/**
 * 发起预约
 * @returns
 * @param {string} data.openid 用户openid
 * @param {string} data.reservation_date 预约日期
 * @param {string} data.reservation_time 预约时间
 * @param {string} data.realname 预约人姓名
 * @param {string} data.telephone 预约人手机号
 * @param {string} data.visitor_number 访客人数
 * @param {string} data.type 访客类型
 */
export const reservation = (data) => api.post('/reservation.php', data)
